blockdev: Restore multipath partition number fallback from device path#2219
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a fallback mechanism to get_esp_partition_number that extracts the partition number from the ESP device path relative to the parent path when standard attributes are missing. The review feedback suggests making the suffix parsing more robust by ensuring only leading digits are extracted (ignoring any trailing non-digit characters like UUIDs) and adding corresponding unit tests.
| if let Some(partn) = esp_device.partn { | ||
| return Ok(partn.to_string()); | ||
| } | ||
| // Last resort: strip the parent device path from the ESP device path, |
There was a problem hiding this comment.
Hmmm....I'm OK with this but I wonder if there's not some way we can actually find the data by looking at the multipath data?
There was a problem hiding this comment.
Might be worth looking into KNAME output of the lsblk command
|
Title comment/commit should be updated to reference the full URL for coreos/bootupd#1006 to not have it point to the bootc repo. |
When the sysfs `partition` attribute is missing on multipath devices and lsblk's `partn` field is also unavailable, fall back to extracting trailing digits from the ESP device path (e.g. `/dev/mapper/mpatha2` → `"2"`). This restores the behavior originally added in bootupd PR [bootc-dev#1006](coreos/bootupd#1006) that was lost during the migration to the bootc-internal-blockdev crate. Assisted-by: Claude Code Signed-off-by: ckyrouac <ckyrouac@redhat.com>
094b918 to
3a4b486
Compare
When the sysfs
partitionattribute is missing on multipath devices and lsblk'spartnfield is also unavailable, fall back to extracting trailing digits from the ESP device path (e.g./dev/mapper/mpatha2→"2"). This restores the behavior originally added in bootupd PR #1006 that was lost during the migration to the bootc-internal-blockdev crate.Assisted-by: Claude Code